import fetch from './index.js'


//发送验证码
export const phoneSendCode = phone => fetch('/sms/send', {
	phone
})

//登出 退出
export const logout = () => fetch('/logout')

//验证 验证码 是否正确
export const checkCode = (validateCode) => fetch('/sms/checkCode', {
	validateCode
})

//注册
export const registered = (mobile, password, validateCode) => fetch('/mobile/registered', {
	mobile,
	password,
	validateCode
})

//登录
export const login = (username, password, mobileLogin) => fetch('/a/login?__ajax=true', {
	username,
	password,
	mobileLogin
})

//救援队长 拒绝订单
export const cancelOffice = (id, remarks) => fetch('/a/mobile/order/cancelOffice', {
	id,
	remarks
})

//出勤人员查询
export const findMyJUserList = () => fetch('/a/mobile/findMyJUserList', )

//等待接单
export const findMissedlist = stateId => fetch('/a/mobile/order/findMissedlist', {
	stateId
})

//查询正在营救
export const findlistok = () => fetch('/a/mobile/order/findlistok')

//查询完成的订单
export const findMyListOk = (pageNo, pageSize = 10) => fetch('/a/mobile/order/findMyListOk', {
	pageNo,
	pageSize
})

//接受订单
export const acceptOrders = (id, usersId) => fetch('/a/mobile/order/acceptOrders', {
	id,
	usersId
})

//改变订单状态
export const orderBtn = (id, state) => fetch('/a/mobile/order/orderBtn', {
	id,
	state
})


//用户 - 一键呼救
export const sosOrders = (longitude, dimensions) => fetch('/a/mobile/order/sosOrders', {
	longitude,
	dimensions
})

//用户 - 查询所有订单
export const userSearchAllRescue = (pageNo, type) => fetch('/a/mobile/order/findUserOrderListAdIos', {
	pageNo,
	state: type,
	pageSize: 10
})

//用户 - 查询附近救援点
export const findlist = () => fetch('/mobile/office/findlist')

//用户 - 未接单数据
export const userWaitAccept = () => fetch('/a/mobile/order/findlist')

//用户 - 正在施救数据
export const userRescue = () => fetch('/a/mobile/order/findSos')

//用户 - 已完成订单
export const userRescueOk = pageNo => fetch('/a/mobile/order/findOk', {
	pageNo,
	pageSize: 10
})

//用户 - 取消订单
export const cancelOrder = (id, remarks) => fetch('/a/mobile/order/cancelOrder', {
	id,
	remarks
})

//用户 - 上传头像
export const updateAvatar = (data, type, config) => fetch('/a/alioss/uploadFile', data, 'POST', type, config)

//用户 - 获取用户信息
export const getUserInfo = () => fetch('/a/mobile/user')

//修改个人资料
export const editUserInfo = userInfo => fetch('/a/mobile/userModify', userInfo);

//用户 - 小常识 / 公告  state = 1 : 常识  --  state = 2 : 公告
export const commonSense = (pageNo, state) => fetch('/article/findPage', {
	pageNo,
	pageSize: 10,
	state
})

//用户 - 文章详情
export const articleDetails = id => fetch('/article/view', {
	id
})

//用户 - 购买救援卡  充值 支付宝
export const recharge = price => fetch('/a/pay/MobilePay', {
	price
})

//用户 - 救援进展
export const userProgress = id => fetch('/a/orderStauts/findByOrderId', {
	id
})

//查询钱包金额
export const allMoney = () => fetch('/a/tyMoney/findMoney')

//实名认证
export const verified = (actualName,idNumber) => fetch('/a/mobile/actualName', {
	idNumber,
	actualName
})
